package org.zachary.agent.interfaces;


import io.swagger.annotations.Api;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.zachary.agent.application.AdminExamineApproveService;
import org.zachary.agent.domain.aggregate_model.check_ucs_info.CheckUserCreditScoreInfo;
import org.zachary.agent.infrastructure.utils.Result;

import java.util.List;

@Api(tags = "用户信用分模块")
@RestController
@RequestMapping("/admin")
public class AdminExamineApproveController {
    private final AdminExamineApproveService adminExamineApproveService;

    public AdminExamineApproveController(AdminExamineApproveService adminExamineApproveService) {
        this.adminExamineApproveService = adminExamineApproveService;
    }

    @GetMapping("/ucs/list")
    @PreAuthorize(value = "hasRole('admin')")
    public Result<List<CheckUserCreditScoreInfo>> getUserCreditScoreInfo(){
        List<CheckUserCreditScoreInfo> list = adminExamineApproveService.getCheckUserCreditScoreInfo();
        System.out.println(list);
        return Result.success(list);
    }

    @PostMapping("/ucs/pass")
    public Result<String> setUserCreditScoreInfoPassed(){

        return Result.success("success");
    }

    @PostMapping("/ucs/not_pass")
    public Result<String> setUserCreditScoreInfoNotPass(){

        return Result.success("success");
    }
}
